//
//  JYTCarRecondsManager.m
//  JYT_IOS
//
//  Created by nxa-chengjinhui on 2017/1/10.
//  Copyright © 2017年 nxa-yuanguoxiang. All rights reserved.
//

#import "JYTCarRecondsManager.h"

@implementation JYTCarRecondsManager

+(JYTCarRecondsManager *)shareCaraReconds{
    static JYTCarRecondsManager *shareCaraReconds = nil;
    static dispatch_once_t predicate;
    dispatch_once(&predicate, ^{
        if (shareCaraReconds==nil) {
            shareCaraReconds = [[self alloc] init];
        }
    });
    return shareCaraReconds;
}

-(void)getData:(NSDictionary *)dic completed:(void (^)(BOOL))completed{

    JYTHttpClient *manager = [JYTHttpClient sharedInstance];
    
    BOOL isUsedOffLine = [[JYTUserManager shared] isUsedOffLine];
    
    if (!isUsedOffLine) {
        
        manager.urlType = userZoneUrl;
    } else {
        manager.urlType = userCenterUrl;
    }
    
    manager.finishCallbackHandler = ^(id result, NSString *code, NSString *msg) {
        
//        NSArray *arr = result[@"data"];
        
        MyLog(@"result训练记录成功========%@",result);
        
        completed(YES);
    };
    
    manager.errorCallbackHandler = ^(NSString * code, NSString * msg) {
        
        
        MyLog(@"result训练记录失败========++++++++++%@",code);
        completed(NO);
    };
    
    [manager post:@"GetDataInfo" withParam:dic];

}

@end
